#-*- codeing = utf-8 -*-
#@Time : 2020/9/10 20:19
#@Author : 阳某
#@File : test3.py
#@Software : PyCharm
import threading
import time
def run(n):
    print("task ",n)
    time.sleep(2)
    print("task ", n, threading.current_thread(), threading.active_count())
start_time = time.time()
listt = []
for i in range(50):
    t = threading.Thread(target=run,args=("t- %s"%i,))
    t.start()

    listt.append(t)
for t in listt:
    t.join()

print('-----all threads finished----',threading.current_thread(),threading.active_count())
print("cost",time.time()-start_time)